using System;
using Gtk;
using System.IO.Ports;

namespace POCarduinoconnection
{
public partial class MainWindow: Gtk.Window
{	
		GGarduinoconnect connector;
	public MainWindow (): base (Gtk.WindowType.Toplevel)
	{
			
			Build ();
			connector = new GGarduinoconnect("COM4");
			connector.trainComing += new EventHandler(trainComingEvent);
	}
	
	protected void OnDeleteEvent (object sender, DeleteEventArgs a)
	{
			connector.destroy();
		Application.Quit ();
		a.RetVal = true;
	}

	protected void OnButtonHWRedClicked (object sender, System.EventArgs e)
	{
		connector.mainRoadRed();
	}

	protected void OnButtonHWorangeClicked (object sender, System.EventArgs e)
	{
		connector.mainRoadYellow();
	}

	protected void OnButtonHWGroenClicked (object sender, System.EventArgs e)
	{
		connector.mainRoadGreen();
	}

	protected void OnButtonZWRoodClicked (object sender, System.EventArgs e)
	{
		connector.sideRoadRed();
	}

	protected void OnButtonZWorangeClicked (object sender, System.EventArgs e)
	{
		connector.sideRoadYellow();
	}

	protected void OnButtonZWGreenClicked (object sender, System.EventArgs e)
	{
		connector.sideRoadGreen();
	}
	void trainComingEvent (object sender, System.EventArgs e)
	{
		progressbarRailway.Text = "TREIN!!!";
	}
}
}